from rest_framework import serializers


class FileSerializer(serializers.Serializer):
    file = serializers.FileField(write_only=True)
    uuid = serializers.UUIDField(default=None)


class ChunkPresignedUrlsSerializer(serializers.Serializer):
    filename = serializers.CharField(label="文件名称", write_only=True)
    chunk_count = serializers.IntegerField(label="分片数量", write_only=True)
    presigned_urls = serializers.ListSerializer(label="预签地址列表", read_only=True, child=serializers.URLField())
    key = serializers.CharField(label="文件key", read_only=True)


class UploadChunkSerializer(serializers.Serializer):
    file = serializers.FileField(write_only=True, label="二进制文件")
    file_url = serializers.URLField(label="文件地址")
    chunk_url = serializers.URLField(label="分片上传地址")


class MergeChunkSerializer(serializers.Serializer):
    key = serializers.CharField(label="文件key", write_only=True)
    UploadId = serializers.CharField(label="上传ID")
